/* ----------------------------------------------------------------------------
* File: quiz_module.h
*
* Desc: Quiz module interface
*
* Created: 18/05/2011, by Alexey Korshunov
* ---------------------------------------------------------------------------- */
#ifndef _QUIZ_MODULE_H_
#define _QUIZ_MODULE_H_

#include <memory>

#include "api_command_dispatcher.h"
#include "base_module.h"
#include "dictionary.h"
#include "user_profile.h"

#define QUIZ_MODULE_NAME				"QuizModule"

namespace QuizCore
{
	class QuizModule 
		: public ModuleManagement::BaseModule
	{
	public:
		QuizModule()
			: BaseModule(QUIZ_MODULE_NAME, ModuleManagement::MODULE_TYPE_QUIZ)
		{
		}
		virtual ~QuizModule()
		{
		}

		virtual Common::Error ShowCommonStatistics() = 0;
		virtual Common::Error ShowUserStatistics() = 0;
		virtual Common::Error ShowPrompt() = 0;
		virtual Common::Error NextQuestion() = 0;
	};

	struct QuizModuleParams
	{
		QuizModuleParams()
			: Dict(NULL)
			, UserProfile(NULL)
			, AttachHandler(NULL)
			, AutoPrompts(false)
			, PromptTime(0)
			, DelayQuestion(0)
			, QuestionTimeout(0)
		{
		}

		/// Dictionary object
		QuizCore::DictionaryManager* Dict;
		/// User profile object
		QuizCore::UserProfileManager* UserProfile;
		/// Event handler for attaching process
		SkypeProtection::APIAttachEventHandler* AttachHandler;
		/// Chat name for game
		std::string ChatName;
		/// Use auto prompts
		bool AutoPrompts;
		/// Time between prompts (in sec)
		unsigned int PromptTime;
		/// Delay between questions (in sec)
		unsigned int DelayQuestion;
		/// Duration for each question
		unsigned int QuestionTimeout;
	};	

	std::auto_ptr<QuizModule> CreateQuizModule(const QuizModuleParams& params);
}

#endif // _QUIZ_MODULE_H_